//
//  BLMeetAlert.m
//  Byelone
//
//  Created by Qi Liu on 2021/2/24.
//

#import "BLMeetAlert.h"

typedef void(^HandelBlock)(void);

@interface BLMeetAlert ()
@property (weak, nonatomic) IBOutlet UIView *baseview;
@property (weak, nonatomic) IBOutlet UIButton *cancelBtn;
@property (weak, nonatomic) IBOutlet UIButton *sureBtn;
@property (weak, nonatomic) IBOutlet UILabel *topLabel;
@property (weak, nonatomic) IBOutlet UILabel *bottomLabel;
@property(nonatomic,copy) HandelBlock block;
@end

@implementation BLMeetAlert

-(void)awakeFromNib{
    [super awakeFromNib];
    
    self.backgroundColor = BL_COLOR_ALPHA;
  
    self.cancelBtn.layer.borderWidth = 0.4;
    self.cancelBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
    
    self.sureBtn.layer.borderWidth = 0.4;
    self.sureBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
    
    self.baseview.layer.cornerRadius = 10;
    self.baseview.layer.masksToBounds = YES;
    
}



+(void)showSendAlertView{
    BLMeetAlert * alert =  [[[NSBundle mainBundle]loadNibNamed:@"BLMeetAlert" owner:nil options:nil]lastObject];
    alert.frame = BL_WINDOW_FRAME;
    [BL_WINDOW addSubview:alert];
}

//-(NSMutableAttributedString *)setUpAtrrSting:(NSMutableAttributedString *)attString{
//    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
//    paragraphStyle.lineSpacing = 5.0; // 设置行间距
//    paragraphStyle.alignment = NSTextAlignmentJustified; //设置两端对齐显示
//    [attString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attString.length)];
//    return attString;
//}




+(void)showBlAlertView:(NSString *)title content:(NSString *)centent cancel:(NSString *)canleStr sure:(NSString *)sureStr{
    
//    NSMutableAttributedString * str = [[NSMutableAttributedString alloc]initWithString:centent];
    
    
}

+(void)showSendAlertViewSign:(void(^)(void))block{
    BLMeetAlert * alert =  [[[NSBundle mainBundle]loadNibNamed:@"BLMeetAlert" owner:nil options:nil]lastObject];
    alert.frame = BL_WINDOW_FRAME;
    alert.topLabel.text = @"您还未登录，无法使用该功能！";
    alert.bottomLabel.text = @"请注册账号登录后再进行功能操作！";
    [alert.sureBtn setTitle:@"注册账号" forState:UIControlStateNormal];
    alert.block = block;
    [BL_WINDOW addSubview:alert];
}

+(void)showSendAlertViewForTest:(void(^)(void))block{
    BLMeetAlert * alert =  [[[NSBundle mainBundle]loadNibNamed:@"BLMeetAlert" owner:nil options:nil]lastObject];
    alert.frame = BL_WINDOW_FRAME;
    alert.topLabel.text = @"您还未做过性格测试，需要先去做完性格测试";
    alert.bottomLabel.text = @"才能开始性格测试对象推荐功能";
    [alert.sureBtn setTitle:@"去做测试" forState:UIControlStateNormal];
    alert.block = block;
    [BL_WINDOW addSubview:alert];
}



- (IBAction)cancleClick:(UIButton *)sender {
    [self disMiss];
}

- (IBAction)sureClick:(id)sender {
    [self disMiss];
}

-(void)disMiss{
    [UIView animateWithDuration:0.3 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
}

@end
